package com.bachongLightNovel.exception;

import com.bachongLightNovel.error.ErrorCodeEnum;
import lombok.Data;

@Data
public class CustomException extends RuntimeException{
    private Integer code;
    private String message;

    private ErrorCodeEnum errorCodeEnum;

    public CustomException(Integer code,String message){
        this.code=code;
        this.message=message;
    }

    public CustomException(ErrorCodeEnum errorCodeEnum){
        this.errorCodeEnum=errorCodeEnum;
        this.code=errorCodeEnum.getCode();
        this.message=errorCodeEnum.getMessage();
    }
}
